Functions for Creating File Previews
The Movie Toolbox provides two functions that allow you to create file previews. File previews contain information that gives the user an idea of a file's contents without opening the file. Typically, a file's preview is a small PICT image (called a
thumbnail
), but previews may also contain other types of information that is appropriate to the type of file being considered. For example, a text file's preview might tell the user when the file was created and what it discusses. For more information about file previews and how to display them, see
"Previewing Files"
.
Note
The
MakeFilePreview
and
AddFilePreview
functions documented in this section are not listed in the MPW
Movies.h
interface file; rather, they appear in the MPW
ImageCompression.h
interface file.
You can use the
MakeFilePreview
function to create a preview for a file. The
AddFilePreview
function allows you to add a preview that you have created to a file.
MakeFilePreview
The
MakeFilePreview
function creates a preview for a file. You should create a preview whenever you save a movie. You specify the file by supplying a reference to its resource file. You must have opened this resource file with write permission.
pascal OSErr MakeFilePreview (short resRefNum,
ICMProgressProcRecordPtr progress);
-
resRefNum
-
Specifies the resource file for this operation. You must have opened this resource file with write permission. If there is a preview in the specified file, the Movie Toolbox replaces that preview with a new one.
-
progress
-
Points to a progress function. During the process of creating the preview, the Movie Toolbox may occasionally call a function you provide in order to report its progress. You can then use this information to keep the user informed.
-
Set this parameter to -1 to use the default progress function. If you specify a progress function, it must comply with the interface defined for Image Compression Manager progress functions (see the chapter "Image Compression Manager" in this book for more information). Set this parameter to
nil
to prevent the Movie Toolbox from calling a progress function. (For details on application-defined progress functions, see
"Progress Functions,"
which begins on
Progress Functions
.)
DESCRIPTION
If there is a preview in the specified file, the Movie Toolbox replaces that preview with a new one.
ERROR CODES
paramErr
|
-50
|
Invalid parameter specified
|
File Manager errors Memory Manager errors Resource Manager errors
AddFilePreview
The
AddFilePreview
function allows you to add a preview to a file. You must have created the preview data yourself. If the specified file already has a preview defined, the
AddFilePreview
function replaces it with the new preview.
pascal OSErr AddFilePreview (short resRefNum, OSType previewType,
Handle previewData);
-
resRefNum
-
Specifies the resource file for this operation. You must have opened this resource file with write permission. If there is a preview in the specified file, the Movie Toolbox replaces that preview with a new one.
-
previewType
-
Specifies the resource type to be assigned to the preview. This type should correspond to the type of data stored in the preview. For example, if you have created a QuickDraw picture that you want to use as a preview for a file, you should set the
previewType
parameter to PICT.
-
previewData
-
Contains a handle to the preview data. For example, if the preview data is a picture, you would provide a picture handle.
DESCRIPTION
If you pass 0 for the
previewType
and
previewData
parameters, the file preview is removed.
ERROR CODES
File Manager errors Memory Manager errors Resource Manager errors
SEE ALSO
You can use the
MakeFilePreview
function, described in the previous section, to create a new preview for a file.
© 1999 Apple Computer, Inc.Previous | Overview | Contents | Next